package tgc.edu.ljc.custom;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import tgc.edu.ljc.entity.Dept;

public class ZtreeUtils {
	public static List<HashMap<String, Object>> buildZtreeResult(List<Dept> list){
		List<HashMap<String,Object>> result=new ArrayList<>();
		for (Dept dept : list) {
			HashMap<String, Object> map=new HashMap<>();
			map.put("id", dept.getId());
			map.put("pId", dept.getParent()==null?null:dept.getParent().getId());
			map.put("name", dept.getName());
			map.put("isParent", dept.getIsParent());
			result.add(map);
		}
		return result;
	}
}
